<!DOCTYPE html>
<html lang="en-US">
<!-- SECTION: Programming -->
<head>
<title>PPD API (DEPRECATED)</title>
<meta name="keywords" content="Programming">
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<meta name="generator" content="codedoc v3.7">
<meta name="author" content="Unknown">
<meta name="language" content="en-US">
<meta name="copyright" content="Unknown">
<meta name="version" content="0.0">
<style type="text/css"><!--
body {
  background: white;
  color: black;
  font-family: sans-serif;
  font-size: 12pt;
}
a {
  color: black;
}
a:link, a:visited {
  color: #00f;
}
a:link:hover, a:visited:hover, a:active {
  color: #c0c;
}
body, p, h1, h2, h3, h4, h5, h6 {
  font-family: sans-serif;
  line-height: 1.4;
}
h1, h2, h3, h4, h5, h6 {
  font-weight: bold;
  page-break-inside: avoid;
}
h1 {
  font-size: 250%;
  margin: 0;
}
h2 {
  font-size: 250%;
  margin-top: 1.5em;
}
h3 {
  font-size: 200%;
  margin-bottom: 0.5em;
  margin-top: 1.5em;
}
h4 {
  font-size: 150%;
  margin-bottom: 0.5em;
  margin-top: 1.5em;
}
h5 {
  font-size: 125%;
  margin-bottom: 0.5em;
  margin-top: 1.5em;
}
h6 {
  font-size: 110%;
  margin-bottom: 0.5em;
  margin-top: 1.5em;
}
img.title {
  width: 256px;
}
div.header h1, div.header p {
  text-align: center;
}
div.contents, div.body, div.footer {
  page-break-before: always;
}
.class, .enumeration, .function, .struct, .typedef, .union {
  border-bottom: solid 2px gray;
}
.description {
  margin-top: 0.5em;
}
.function {
  margin-bottom: 0;
}
blockquote {
  border: solid thin gray;
  box-shadow: 3px 3px 5px rgba(127,127,127,0.25);
  margin: 1em 0;
  padding: 10px;
  page-break-inside: avoid;
}
p code, li code, p.code, pre, ul.code li {
  font-family: monospace;
  hyphens: manual;
  -webkit-hyphens: manual;
}
p.code, pre, ul.code li {
  background: rgba(127,127,127,0.25);
  border: thin dotted gray;
  padding: 10px;
  page-break-inside: avoid;
}
pre {
  white-space: pre-wrap;
}
a:link, a:visited {
  text-decoration: none;
}
span.info {
  background: black;
  border: solid thin black;
  color: white;
  font-size: 80%;
  font-style: italic;
  font-weight: bold;
  white-space: nowrap;
}
h1 span.info, h2 span.info, h3 span.info, h4 span.info {
  border-top-left-radius: 10px;
  border-top-right-radius: 10px;
  float: right;
  padding: 3px 6px;
}
ul.code, ul.contents, ul.subcontents {
  list-style-type: none;
  margin: 0;
  padding-left: 0;
}
ul.code li {
  margin: 0;
}
ul.contents > li {
  margin-top: 1em;
}
ul.contents li ul.code, ul.contents li ul.subcontents {
  padding-left: 2em;
}
table {
  border-collapse: collapse;
  border-spacing: 0;
}
td {
  border: solid 1px gray;
  padding: 5px 10px;
  vertical-align: top;
}
td.left {
  text-align: left;
}
td.center {
  text-align: center;
}
td.right {
  text-align: right;
}
th {
  border-bottom: solid 2px gray;
  padding: 1px 5px;
  text-align: center;
  vertical-align: bottom;
}
tr:nth-child(even) {
  background: rgba(127,127,127,0.25);
}
table.list {
  border-collapse: collapse;
  width: 100%;
}
table.list th {
  border-bottom: none;
  border-right: 2px solid gray;
  font-family: monospace;
  font-weight: normal;
  padding: 5px 10px 5px 2px;
  text-align: right;
  vertical-align: top;
}
table.list td {
  border: none;
  padding: 5px 2px 5px 10px;
  text-align: left;
  vertical-align: top;
}
h2.title, h3.title {
  border-bottom: solid 2px gray;
}
/* Syntax highlighting */
span.comment {
  color: darkgreen;
}
span.directive {
  color: purple;
}
span.number {
  color: brown;
}
span.reserved {
  color: darkcyan;
}
span.string {
  color: magenta;
}
/* Dark mode overrides */
@media (prefers-color-scheme: dark) {
  body {
    background: black;
    color: #ccc;
  }
  a {
    color: #ccc;
  }
  a:link, a:visited {
    color: #66f;
  }
  a:link:hover, a:visited:hover, a:active {
    color: #f06;
  }
}
/* Show contents on left side in web browser */
@media screen and (min-width: 800px) {
  div.contents {
    border-right: solid thin gray;
    bottom: 0px;
    box-shadow: 3px 3px 5px rgba(127,127,127,0.5);
    font-size: 10pt;
    left: 0px;
    overflow: scroll;
    padding: 1%;
    position: fixed;
    top: 0px;
    width: 18%;
  }
  div.contents h2.title {
    margin-top: 0px;
  }
  div.header, div.body, div.footer {
    margin-left: 20%;
    padding: 1% 2%;
  }
}
/* Center title page content vertically */
@media print {
  div.header {
    padding-top: 33%;
  }
}
--></style>
</head>
<body>
<div class="header">
<!--
  PPD API header for CUPS.

  Copyright © 2020-2024 by OpenPrinting.
  Copyright © 2008-2019 by Apple Inc.

  Licensed under Apache License v2.0.  See the file "LICENSE" for more
  information.
-->

<h1 class='title'>PPD API (DEPRECATED)</h1>

<blockquote><b>Note:</b>

<p>The PPD API was deprecated in CUPS 1.6/macOS 10.8. Please use the new Job Ticket APIs in the <a href="cupspm.html">CUPS Programming Manual</a> documentation. These functions will be removed in a future release of CUPS.</p>
</blockquote>

<div class='summary'><table summary='General Information'>
<thead>
<tr>
	<th>Header</th>
	<th>cups/ppd.h</th>
</tr>
</thead>
<tbody>
<tr>
	<th>Library</th>
	<td>-lcups</td>
</tr>
<tr>
	<th>See Also</th>
	<td>Programming: <a href='api-overview.html' target='_top'>Introduction to CUPS Programming</a><br>
	Programming: <a href='cupspm.html' target='_top'>CUPS Programming Manual</a><br>
	Specifications: <a href='spec-ppd.html' target='_top'>CUPS PPD Extensions</a></td>
</tr>
</tbody>
</table></div>
</div>
<div class="contents">
<h2 class="title">Contents</h2>
<ul class="contents">
<li><a href="#OVERVIEW">Overview</a><ul class="subcontents">
<li><a href="#LOADING">Loading a PPD File</a></li>
<li><a href="#OPTIONS_AND_GROUPS">Options and Groups</a></li>
<li><a href="#CONSTRAINTS">Constraints</a></li>
<li><a href="#PAGE_SIZES">Page Sizes</a></li>
<li><a href="#ATTRIBUTES">Attributes</a></li>
</ul></li>
<li><a href="#FUNCTIONS">Functions</a><ul class="subcontents">
<li><a href="#cupsGetConflicts">cupsGetConflicts</a></li>
<li><a href="#cupsGetPPD">cupsGetPPD</a></li>
<li><a href="#cupsGetPPD2">cupsGetPPD2</a></li>
<li><a href="#cupsGetPPD3">cupsGetPPD3</a></li>
<li><a href="#cupsGetServerPPD">cupsGetServerPPD</a></li>
<li><a href="#cupsMarkOptions">cupsMarkOptions</a></li>
<li><a href="#cupsRasterInterpretPPD">cupsRasterInterpretPPD</a></li>
<li><a href="#cupsResolveConflicts">cupsResolveConflicts</a></li>
<li><a href="#ppdCollect">ppdCollect</a></li>
<li><a href="#ppdCollect2">ppdCollect2</a></li>
<li><a href="#ppdConflicts">ppdConflicts</a></li>
<li><a href="#ppdEmit">ppdEmit</a></li>
<li><a href="#ppdEmitAfterOrder">ppdEmitAfterOrder</a></li>
<li><a href="#ppdEmitFd">ppdEmitFd</a></li>
<li><a href="#ppdEmitJCL">ppdEmitJCL</a></li>
<li><a href="#ppdEmitJCLEnd">ppdEmitJCLEnd</a></li>
<li><a href="#ppdEmitString">ppdEmitString</a></li>
<li><a href="#ppdFindAttr">ppdFindAttr</a></li>
<li><a href="#ppdFindChoice">ppdFindChoice</a></li>
<li><a href="#ppdFindCustomOption">ppdFindCustomOption</a></li>
<li><a href="#ppdFindCustomParam">ppdFindCustomParam</a></li>
<li><a href="#ppdFindMarkedChoice">ppdFindMarkedChoice</a></li>
<li><a href="#ppdFindNextAttr">ppdFindNextAttr</a></li>
<li><a href="#ppdFindOption">ppdFindOption</a></li>
<li><a href="#ppdFirstCustomParam">ppdFirstCustomParam</a></li>
<li><a href="#ppdFirstOption">ppdFirstOption</a></li>
<li><a href="#ppdInstallableConflict">ppdInstallableConflict</a></li>
<li><a href="#ppdIsMarked">ppdIsMarked</a></li>
<li><a href="#ppdLocalize">ppdLocalize</a></li>
<li><a href="#ppdLocalizeAttr">ppdLocalizeAttr</a></li>
<li><a href="#ppdLocalizeIPPReason">ppdLocalizeIPPReason</a></li>
<li><a href="#ppdLocalizeMarkerName">ppdLocalizeMarkerName</a></li>
<li><a href="#ppdMarkDefaults">ppdMarkDefaults</a></li>
<li><a href="#ppdMarkOption">ppdMarkOption</a></li>
<li><a href="#ppdNextCustomParam">ppdNextCustomParam</a></li>
<li><a href="#ppdNextOption">ppdNextOption</a></li>
<li><a href="#ppdPageLength">ppdPageLength</a></li>
<li><a href="#ppdPageSize">ppdPageSize</a></li>
<li><a href="#ppdPageSizeLimits">ppdPageSizeLimits</a></li>
<li><a href="#ppdPageWidth">ppdPageWidth</a></li>
</ul></li>
<li><a href="#TYPES">Data Types</a><ul class="subcontents">
<li><a href="#cups_interpret_cb_t">cups_interpret_cb_t</a></li>
<li><a href="#ppd_attr_t">ppd_attr_t</a></li>
<li><a href="#ppd_choice_t">ppd_choice_t</a></li>
<li><a href="#ppd_conform_t">ppd_conform_t</a></li>
<li><a href="#ppd_cs_t">ppd_cs_t</a></li>
<li><a href="#ppd_option_t">ppd_option_t</a></li>
<li><a href="#ppd_section_t">ppd_section_t</a></li>
<li><a href="#ppd_status_t">ppd_status_t</a></li>
<li><a href="#ppd_ui_t">ppd_ui_t</a></li>
</ul></li>
<li><a href="#STRUCTURES">Structures</a><ul class="subcontents">
<li><a href="#ppd_attr_s">ppd_attr_s</a></li>
<li><a href="#ppd_choice_s">ppd_choice_s</a></li>
<li><a href="#ppd_group_s">ppd_group_s</a></li>
<li><a href="#ppd_option_s">ppd_option_s</a></li>
</ul></li>
<li><a href="#ENUMERATIONS">Enumerations</a><ul class="subcontents">
<li><a href="#ppd_conform_e">ppd_conform_e</a></li>
<li><a href="#ppd_cs_e">ppd_cs_e</a></li>
<li><a href="#ppd_section_e">ppd_section_e</a></li>
<li><a href="#ppd_status_e">ppd_status_e</a></li>
<li><a href="#ppd_ui_e">ppd_ui_e</a></li>
</ul></li>
</ul>
</div>
<div class="body">
<!--
  PPD API introduction for CUPS.

  Copyright © 2007-2019 by Apple Inc.
  Copyright © 1997-2006 by Easy Software Products, all rights reserved.

  Licensed under Apache License v2.0.  See the file "LICENSE" for more
  information.
-->

<h2 class='title'><a name='OVERVIEW'>Overview</a></h2>

<blockquote><b>Note:</b>

<p>The PPD API was deprecated in CUPS 1.6/macOS 10.8. Please use the new Job Ticket APIs in the <a href="cupspm.html">CUPS Programming Manual</a> documentation. These functions will be removed in a future release of CUPS.</p>
</blockquote>

<p>The CUPS PPD API provides read-only access the data in PostScript Printer
Description ("PPD") files which are used for all printers with a driver. With
it you can obtain the data necessary to display printer options to users, mark
option choices and check for conflicting choices, and output marked choices in
PostScript output. The <a href="#ppd_file_t"><code>ppd_file_t</code></a>
structure contains all of the information in a PPD file.</p>

<blockquote><b>Note:</b>

<p>The CUPS PPD API uses the terms "option" and "choice" instead of the Adobe
terms "MainKeyword" and "OptionKeyword" to refer to specific printer options and
features. CUPS also treats option ("MainKeyword") and choice ("OptionKeyword")
values as case-insensitive strings, so option "InputSlot" and choice "Upper"
are equivalent to "inputslot" and "upper", respectively.</p>
</blockquote>


<h3><a name="LOADING">Loading a PPD File</a></h3>

<p>The <a href="#ppdOpenFile"><code>ppdOpenFile</code></a> function "opens" a
PPD file and loads it into memory. For example, the following code opens the
current printer's PPD file in a CUPS filter:</p>

<pre class="example">
#include &lt;cups/ppd.h&gt;

<a href="#ppd_file_t">ppd_file_t</a> *ppd = <a href="#ppdOpenFile">ppdOpenFile</a>(getenv("PPD"));
</pre>

<p>The return value is a pointer to a new
<a href="#ppd_file_t"><code>ppd_file_t</code></a> structure or <code>NULL</code>
if the PPD file does not exist or cannot be loaded. The
<a href="#ppdClose"><code>ppdClose</code></a> function frees the memory used
by the structure:</p>

<pre class="example">
#include &lt;cups/ppd.h&gt;

<a href="#ppd_file_t">ppd_file_t</a> *ppd;

<a href="#ppdClose">ppdClose</a>(ppd);
</pre>

<p>Once closed, pointers to the <a href="#ppd_file_t"><code>ppd_file_t</code></a>
structure and any data in it will no longer be valid.</p>

<h3><a name="OPTIONS_AND_GROUPS">Options and Groups</a></h3>

<p>PPD files support multiple options, which are stored in arrays of
<a href="#ppd_option_t"><code>ppd_option_t</code></a> and
<a href="#ppd_choice_t"><code>ppd_choice_t</code></a> structures.</p>

<p>Each option in turn is associated with a group stored in a
<a href="#ppd_group_t"><code>ppd_group_t</code></a> structure. Groups can be
specified in the PPD file; if an option is not associated with a group
then it is put in an automatically-generated "General" group. Groups can also
have sub-groups, however CUPS currently ignores sub-groups because of past
abuses of this functionality.</p>

<p>Option choices are selected by marking them using one of three functions. The
first is <a href="#ppdMarkDefaults"><code>ppdMarkDefaults</code></a> which
selects all of the default options in the PPD file:</p>

<pre class="example">
#include &lt;cups/ppd.h&gt;

<a href="#ppd_file_t">ppd_file_t</a> *ppd;

<a href="#ppdMarkDefaults">ppdMarkDefaults</a>(ppd);
</pre>

<p>The second is <a href="#ppdMarkOption"><code>ppdMarkOption</code></a>
which selects a single option choice in the PPD file. For example, the following
code selects the upper paper tray:</p>

<pre class="example">
#include &lt;cups/ppd.h&gt;

<a href="#ppd_file_t">ppd_file_t</a> *ppd;

<a href="#ppdMarkOption">ppdMarkOption</a>(ppd, "InputSlot", "Upper");
</pre>

<p>The last function is
<a href="#cupsMarkOptions"><code>cupsMarkOptions</code></a> which selects
multiple option choices in the PPD file from an array of CUPS options, mapping
IPP attributes like "media" and "sides" to their corresponding PPD options. You
typically use this function in a print filter with
<code>cupsParseOptions</code> and
<a href="#ppdMarkDefaults"><code>ppdMarkDefaults</code></a> to select all of
the option choices needed for the job, for example:</p>

<pre class="example">
#include &lt;cups/ppd.h&gt;

<a href="#ppd_file_t">ppd_file_t</a> *ppd = <a href="#ppdOpenFile">ppdOpenFile</a>(getenv("PPD"));
cups_option_t *options = NULL;
int num_options = cupsParseOptions(argv[5], 0, &amp;options);

<a href="#ppdMarkDefaults">ppdMarkDefaults</a>(ppd);
<a href="#cupsMarkOptions">cupsMarkOptions</a>(ppd, num_options, options);
cupsFreeOptions(num_options, options);
</pre>


<h3><a name="CONSTRAINTS">Constraints</a></h3>

<p>PPD files support specification of conflict conditions, called
constraints, between different options. Constraints are stored in an array of
<a href="#ppd_const_t"><code>ppd_const_t</code></a> structures which specify
the options and choices that conflict with each other. The
<a href="#ppdConflicts"><code>ppdConflicts</code></a> function tells you
how many of the selected options are incompatible. Since constraints are
normally specified in pairs, the returned value is typically an even number.</p>


<h3><a name="PAGE_SIZES">Page Sizes</a></h3>

<p>Page sizes are special options which have physical dimensions and margins
associated with them. The size information is stored in
<a href="#ppd_size_t"><code>ppd_size_t</code></a> structures and is available
by looking up the named size with the
<a href="#ppdPageSize"><code>ppdPageSize</code></a> function. The page size and
margins are returned in units called points; there are 72 points per inch. If
you pass <code>NULL</code> for the size, the currently selected size is
returned:</p>

<pre class="example">
#include &lt;cups/ppd.h&gt;

<a href="#ppd_file_t">ppd_file_t</a> *ppd;
<a href="#ppd_size_t">ppd_size_t</a> *size = <a href="#ppdPageSize">ppdPageSize</a>(ppd, NULL);
</pre>

<p>Besides the standard page sizes listed in a PPD file, some printers
support variable or custom page sizes. Custom page sizes are supported if the
<code>variables_sizes</code> member of the
<a href="#ppd_file_t"><code>ppd_file_t</code></a> structure is non-zero.
The <code>custom_min</code>, <code>custom_max</code>, and
<code>custom_margins</code> members of the
<a href="#ppd_file_t"><code>ppd_file_t</code></a> structure define the limits
of the printable area. To get the resulting media size, use a page size string
of the form "Custom.<I>width</I>x<I>length</I>", where "width" and "length" are
in points. Custom page size names can also be specified in inches
("Custom.<i>width</i>x<i>height</i>in"), centimeters
("Custom.<i>width</i>x<i>height</i>cm"), or millimeters
("Custom.<i>width</i>x<i>height</i>mm"):</p>

<pre class="example">
#include &lt;cups/ppd.h&gt;

<a href="#ppd_file_t">ppd_file_t</a> *ppd;

/* Get an 576x720 point custom page size */
<a href="#ppd_size_t">ppd_size_t</a> *size = <a href="#ppdPageSize">ppdPageSize</a>(ppd, "Custom.576x720");

/* Get an 8x10 inch custom page size */
<a href="#ppd_size_t">ppd_size_t</a> *size = <a href="#ppdPageSize">ppdPageSize</a>(ppd, "Custom.8x10in");

/* Get a 100x200 millimeter custom page size */
<a href="#ppd_size_t">ppd_size_t</a> *size = <a href="#ppdPageSize">ppdPageSize</a>(ppd, "Custom.100x200mm");

/* Get a 12.7x34.5 centimeter custom page size */
<a href="#ppd_size_t">ppd_size_t</a> *size = <a href="#ppdPageSize">ppdPageSize</a>(ppd, "Custom.12.7x34.5cm");
</pre>

<p>If the PPD does not support variable page sizes, the
<a href="#ppdPageSize"><code>ppdPageSize</code></a> function will return
<code>NULL</code>.</p>


<h3><a name="ATTRIBUTES">Attributes</a></h3>

<p>Every PPD file is composed of one or more attributes. Most of these
attributes are used to define groups, options, choices, and page sizes,
however several informational attributes may be present which you can access
in your program or filter. Attributes normally look like one of the following
examples in a PPD file:</p>

<pre class="example">
*name: "value"
*name spec: "value"
*name spec/text: "value"
</pre>

<p>The <a href="#ppdFindAttr"><code>ppdFindAttr</code></a> and
<a href="#ppdFindNextAttr"><code>ppdFindNextAttr</code></a> functions find the
first and next instances, respectively, of the named attribute with the given
"spec" string and return a <a href="#ppd_attr_t"><code>ppd_attr_t</code></a>
structure. If you provide a NULL specifier string, all attributes with the
given name will be returned. For example, the following code lists all of the
<code>Product</code> attributes in a PPD file:</p>

<pre class="example">
#include &lt;cups/ppd.h&gt;

<a href="#ppd_file_t">ppd_file_t</a> *ppd;
<a href="#ppd_attr_t">ppd_attr_t</a> *attr;

for (attr = <a href="#ppdFindAttr">ppdFindAttr</a>(ppd, "Product", NULL);
     attr != NULL;
     attr = <a href="#ppdFindNextAttr">ppdFindNextAttr</a>(ppd, "Product", NULL))
  puts(attr->value);
</pre>
<h2 class="title"><a id="FUNCTIONS">Functions</a></h2>
<h3 class="function"><span class="info">&#160;CUPS 1.4/macOS 10.6&#160;</span><a id="cupsGetConflicts">cupsGetConflicts</a></h3>
<p class="description">Get a list of conflicting options in a marked PPD.</p>
<p class="code">
int cupsGetConflicts(ppd_file_t *ppd, const char *option, const char *choice, cups_option_t **options);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>ppd</th>
<td class="description">PPD file</td></tr>
<tr><th>option</th>
<td class="description">Option to test</td></tr>
<tr><th>choice</th>
<td class="description">Choice to test</td></tr>
<tr><th>options</th>
<td class="description">Conflicting options</td></tr>
</tbody></table>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Number of conflicting options</p>
<h4 class="discussion">Discussion</h4>
<p class="discussion">This function gets a list of options that would conflict if &quot;option&quot; and
&quot;choice&quot; were marked in the PPD.  You would typically call this function
after marking the currently selected options in the PPD in order to
determine whether a new option selection would cause a conflict.<br>
<br>
The number of conflicting options are returned with &quot;options&quot; pointing to
the conflicting options.  The returned option array must be freed using
<a href="#cupsFreeOptions"><code>cupsFreeOptions</code></a>.

</p>
<h3 class="function"><a id="cupsGetPPD">cupsGetPPD</a></h3>
<p class="description">Get the PPD file for a printer on the default server.</p>
<p class="code">
const char *cupsGetPPD(const char *name);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>name</th>
<td class="description">Destination name</td></tr>
</tbody></table>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Filename for PPD file</p>
<h4 class="discussion">Discussion</h4>
<p class="discussion">For classes, <code>cupsGetPPD</code> returns the PPD file for the first printer
in the class.<br>
<br>
The returned filename is stored in a static buffer and is overwritten with
each call to <code>cupsGetPPD</code> or <a href="#cupsGetPPD2"><code>cupsGetPPD2</code></a>.  The caller &quot;owns&quot; the
file that is created and must <code>unlink</code> the returned filename.</p>
<h3 class="function"><span class="info">&#160;CUPS 1.1.21/macOS 10.4&#160;</span><a id="cupsGetPPD2">cupsGetPPD2</a></h3>
<p class="description">Get the PPD file for a printer from the specified server.</p>
<p class="code">
const char *cupsGetPPD2(http_t *http, const char *name);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>http</th>
<td class="description">Connection to server or <code>CUPS_HTTP_DEFAULT</code></td></tr>
<tr><th>name</th>
<td class="description">Destination name</td></tr>
</tbody></table>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Filename for PPD file</p>
<h4 class="discussion">Discussion</h4>
<p class="discussion">For classes, <code>cupsGetPPD2</code> returns the PPD file for the first printer
in the class.<br>
<br>
The returned filename is stored in a static buffer and is overwritten with
each call to <a href="#cupsGetPPD"><code>cupsGetPPD</code></a> or <code>cupsGetPPD2</code>.  The caller &quot;owns&quot; the
file that is created and must <code>unlink</code> the returned filename.

</p>
<h3 class="function"><span class="info">&#160;CUPS 1.4/macOS 10.6&#160;</span><a id="cupsGetPPD3">cupsGetPPD3</a></h3>
<p class="description">Get the PPD file for a printer on the specified
                  server if it has changed.</p>
<p class="code">
http_status_t cupsGetPPD3(http_t *http, const char *name, time_t *modtime, char *buffer, size_t bufsize);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>http</th>
<td class="description">HTTP connection or <code>CUPS_HTTP_DEFAULT</code></td></tr>
<tr><th>name</th>
<td class="description">Destination name</td></tr>
<tr><th>modtime</th>
<td class="description">Modification time</td></tr>
<tr><th>buffer</th>
<td class="description">Filename buffer</td></tr>
<tr><th>bufsize</th>
<td class="description">Size of filename buffer</td></tr>
</tbody></table>
<h4 class="returnvalue">Return Value</h4>
<p class="description">HTTP status</p>
<h4 class="discussion">Discussion</h4>
<p class="discussion">The &quot;modtime&quot; parameter contains the modification time of any
locally-cached content and is updated with the time from the PPD file on
the server.<br>
<br>
The &quot;buffer&quot; parameter contains the local PPD filename.  If it contains
the empty string, a new temporary file is created, otherwise the existing
file will be overwritten as needed.  The caller &quot;owns&quot; the file that is
created and must <code>unlink</code> the returned filename.<br>
<br>
On success, <code>HTTP_STATUS_OK</code> is returned for a new PPD file and
<code>HTTP_STATUS_NOT_MODIFIED</code> if the existing PPD file is up-to-date.  Any other
status is an error.<br>
<br>
For classes, <code>cupsGetPPD3</code> returns the PPD file for the first printer
in the class.

</p>
<h3 class="function"><span class="info">&#160;CUPS 1.3/macOS 10.5&#160;</span><a id="cupsGetServerPPD">cupsGetServerPPD</a></h3>
<p class="description">Get an available PPD file from the server.</p>
<p class="code">
char *cupsGetServerPPD(http_t *http, const char *name);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>http</th>
<td class="description">Connection to server or <code>CUPS_HTTP_DEFAULT</code></td></tr>
<tr><th>name</th>
<td class="description">Name of PPD file (&quot;ppd-name&quot;)</td></tr>
</tbody></table>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Name of PPD file or <code>NULL</code> on error</p>
<h4 class="discussion">Discussion</h4>
<p class="discussion">This function returns the named PPD file from the server.  The
list of available PPDs is provided by the IPP <code>CUPS_GET_PPDS</code>
operation.<br>
<br>
You must remove (unlink) the PPD file when you are finished with
it. The PPD filename is stored in a static location that will be
overwritten on the next call to <a href="#cupsGetPPD"><code>cupsGetPPD</code></a>, <a href="#cupsGetPPD2"><code>cupsGetPPD2</code></a>,
or <a href="#cupsGetServerPPD"><code>cupsGetServerPPD</code></a>.

</p>
<h3 class="function"><a id="cupsMarkOptions">cupsMarkOptions</a></h3>
<p class="description">Mark command-line options in a PPD file.</p>
<p class="code">
int cupsMarkOptions(ppd_file_t *ppd, int num_options, cups_option_t *options);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>ppd</th>
<td class="description">PPD file</td></tr>
<tr><th>num_options</th>
<td class="description">Number of options</td></tr>
<tr><th>options</th>
<td class="description">Options</td></tr>
</tbody></table>
<h4 class="returnvalue">Return Value</h4>
<p class="description">1 if conflicts exist, 0 otherwise</p>
<h4 class="discussion">Discussion</h4>
<p class="discussion">This function maps the IPP &quot;finishings&quot;, &quot;media&quot;, &quot;mirror&quot;,
&quot;multiple-document-handling&quot;, &quot;output-bin&quot;, &quot;print-color-mode&quot;,
&quot;print-quality&quot;, &quot;printer-resolution&quot;, and &quot;sides&quot; attributes to their
corresponding PPD options and choices.</p>
<h3 class="function"><span class="info">&#160;CUPS 1.2/macOS 10.5&#160;</span><a id="cupsRasterInterpretPPD">cupsRasterInterpretPPD</a></h3>
<p class="description">Interpret PPD commands to create a page header.</p>
<p class="code">
int cupsRasterInterpretPPD(cups_page_header2_t *h, ppd_file_t *ppd, int num_options, cups_option_t *options, <a href="#cups_interpret_cb_t">cups_interpret_cb_t</a> func);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>h</th>
<td class="description">Page header to create</td></tr>
<tr><th>ppd</th>
<td class="description">PPD file</td></tr>
<tr><th>num_options</th>
<td class="description">Number of options</td></tr>
<tr><th>options</th>
<td class="description">Options</td></tr>
<tr><th>func</th>
<td class="description">Optional page header callback (<code>NULL</code> for none)</td></tr>
</tbody></table>
<h4 class="returnvalue">Return Value</h4>
<p class="description">0 on success, -1 on failure</p>
<h4 class="discussion">Discussion</h4>
<p class="discussion">This function is used by raster image processing (RIP) filters like
cgpdftoraster and imagetoraster when writing CUPS raster data for a page.
It is not used by raster printer driver filters which only read CUPS
raster data.<br>
<br>

<code>cupsRasterInterpretPPD</code> does not mark the options in the PPD using
the &quot;num_options&quot; and &quot;options&quot; arguments.  Instead, mark the options with
<code>cupsMarkOptions</code> and <code>ppdMarkOption</code> prior to calling it -
this allows for per-page options without manipulating the options array.<br>
<br>
The &quot;func&quot; argument specifies an optional callback function that is
called prior to the computation of the final raster data.  The function
can make changes to the <a href="#cups_page_header2_t"><code>cups_page_header2_t</code></a> data as needed to use a
supported raster format and then returns 0 on success and -1 if the
requested attributes cannot be supported.<br>
<br>

<code>cupsRasterInterpretPPD</code> supports a subset of the PostScript language.
Currently only the <code>[</code>, <code>]</code>, <code>&lt;&lt;</code>, <code>&gt;&gt;</code>, <code>{</code>,
<code>}</code>, <code>cleartomark</code>, <code>copy</code>, <code>dup</code>, <code>index</code>,
<code>pop</code>, <code>roll</code>, <code>setpagedevice</code>, and <code>stopped</code> operators
are supported.

</p>
<h3 class="function"><span class="info">&#160;CUPS 1.4/macOS 10.6&#160;</span><a id="cupsResolveConflicts">cupsResolveConflicts</a></h3>
<p class="description">Resolve conflicts in a marked PPD.</p>
<p class="code">
int cupsResolveConflicts(ppd_file_t *ppd, const char *option, const char *choice, int *num_options, cups_option_t **options);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>ppd</th>
<td class="description">PPD file</td></tr>
<tr><th>option</th>
<td class="description">Newly selected option or <code>NULL</code> for none</td></tr>
<tr><th>choice</th>
<td class="description">Newly selected choice or <code>NULL</code> for none</td></tr>
<tr><th>num_options</th>
<td class="description">Number of additional selected options</td></tr>
<tr><th>options</th>
<td class="description">Additional selected options</td></tr>
</tbody></table>
<h4 class="returnvalue">Return Value</h4>
<p class="description">1 on success, 0 on failure</p>
<h4 class="discussion">Discussion</h4>
<p class="discussion">This function attempts to resolve any conflicts in a marked PPD, returning
a list of option changes that are required to resolve them.  On input,
&quot;num_options&quot; and &quot;options&quot; contain any pending option changes that have
not yet been marked, while &quot;option&quot; and &quot;choice&quot; contain the most recent
selection which may or may not be in &quot;num_options&quot; or &quot;options&quot;.<br>
<br>
On successful return, &quot;num_options&quot; and &quot;options&quot; are updated to contain
&quot;option&quot; and &quot;choice&quot; along with any changes required to resolve conflicts
specified in the PPD file and 1 is returned.<br>
<br>
If option conflicts cannot be resolved, &quot;num_options&quot; and &quot;options&quot; are not
changed and 0 is returned.<br>
<br>
When resolving conflicts, <code>cupsResolveConflicts</code> does not consider
changes to the current page size (<code>media</code>, <code>PageSize</code>, and
<code>PageRegion</code>) or to the most recent option specified in &quot;option&quot;.
Thus, if the only way to resolve a conflict is to change the page size
or the option the user most recently changed, <code>cupsResolveConflicts</code>
will return 0 to indicate it was unable to resolve the conflicts.<br>
<br>
The <code>cupsResolveConflicts</code> function uses one of two sources of option
constraint information.  The preferred constraint information is defined by
<code>cupsUIConstraints</code> and <code>cupsUIResolver</code> attributes - in this
case, the PPD file provides constraint resolution actions.<br>
<br>
The backup constraint information is defined by the
<code>UIConstraints</code> and <code>NonUIConstraints</code> attributes.  These
constraints are resolved algorithmically by first selecting the default
choice for the conflicting option, then iterating over all possible choices
until a non-conflicting option choice is found.

</p>
<h3 class="function"><a id="ppdCollect">ppdCollect</a></h3>
<p class="description">Collect all marked options that reside in the specified
                 section.</p>
<p class="code">
int ppdCollect(ppd_file_t *ppd, <a href="#ppd_section_t">ppd_section_t</a> section, <a href="#ppd_choice_t">ppd_choice_t</a> ***choices);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>ppd</th>
<td class="description">PPD file data</td></tr>
<tr><th>section</th>
<td class="description">Section to collect</td></tr>
<tr><th>choices</th>
<td class="description">Pointers to choices</td></tr>
</tbody></table>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Number of options marked</p>
<h4 class="discussion">Discussion</h4>
<p class="discussion">The choices array should be freed using <code>free</code> when you are
finished with it.</p>
<h3 class="function"><span class="info">&#160;CUPS 1.2/macOS 10.5&#160;</span><a id="ppdCollect2">ppdCollect2</a></h3>
<p class="description">Collect all marked options that reside in the
                  specified section and minimum order.</p>
<p class="code">
int ppdCollect2(ppd_file_t *ppd, <a href="#ppd_section_t">ppd_section_t</a> section, float min_order, <a href="#ppd_choice_t">ppd_choice_t</a> ***choices);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>ppd</th>
<td class="description">PPD file data</td></tr>
<tr><th>section</th>
<td class="description">Section to collect</td></tr>
<tr><th>min_order</th>
<td class="description">Minimum OrderDependency value</td></tr>
<tr><th>choices</th>
<td class="description">Pointers to choices</td></tr>
</tbody></table>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Number of options marked</p>
<h4 class="discussion">Discussion</h4>
<p class="discussion">The choices array should be freed using <code>free</code> when you are
finished with it.

</p>
<h3 class="function"><a id="ppdConflicts">ppdConflicts</a></h3>
<p class="description">Check to see if there are any conflicts among the
                   marked option choices.</p>
<p class="code">
int ppdConflicts(ppd_file_t *ppd);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>ppd</th>
<td class="description">PPD to check</td></tr>
</tbody></table>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Number of conflicts found</p>
<h4 class="discussion">Discussion</h4>
<p class="discussion">The returned value is the same as returned by <a href="#ppdMarkOption"><code>ppdMarkOption</code></a>.</p>
<h3 class="function"><a id="ppdEmit">ppdEmit</a></h3>
<p class="description">Emit code for marked options to a file.</p>
<p class="code">
int ppdEmit(ppd_file_t *ppd, FILE *fp, <a href="#ppd_section_t">ppd_section_t</a> section);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>ppd</th>
<td class="description">PPD file record</td></tr>
<tr><th>fp</th>
<td class="description">File to write to</td></tr>
<tr><th>section</th>
<td class="description">Section to write</td></tr>
</tbody></table>
<h4 class="returnvalue">Return Value</h4>
<p class="description">0 on success, -1 on failure</p>
<h3 class="function"><span class="info">&#160;CUPS 1.2/macOS 10.5&#160;</span><a id="ppdEmitAfterOrder">ppdEmitAfterOrder</a></h3>
<p class="description">Emit a subset of the code for marked options to a file.</p>
<p class="code">
int ppdEmitAfterOrder(ppd_file_t *ppd, FILE *fp, <a href="#ppd_section_t">ppd_section_t</a> section, int limit, float min_order);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>ppd</th>
<td class="description">PPD file record</td></tr>
<tr><th>fp</th>
<td class="description">File to write to</td></tr>
<tr><th>section</th>
<td class="description">Section to write</td></tr>
<tr><th>limit</th>
<td class="description">Non-zero to use min_order</td></tr>
<tr><th>min_order</th>
<td class="description">Lowest OrderDependency</td></tr>
</tbody></table>
<h4 class="returnvalue">Return Value</h4>
<p class="description">0 on success, -1 on failure</p>
<h4 class="discussion">Discussion</h4>
<p class="discussion">When &quot;limit&quot; is non-zero, this function only emits options whose
OrderDependency value is greater than or equal to &quot;min_order&quot;.<br>
<br>
When &quot;limit&quot; is zero, this function is identical to ppdEmit().

</p>
<h3 class="function"><a id="ppdEmitFd">ppdEmitFd</a></h3>
<p class="description">Emit code for marked options to a file.</p>
<p class="code">
int ppdEmitFd(ppd_file_t *ppd, int fd, <a href="#ppd_section_t">ppd_section_t</a> section);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>ppd</th>
<td class="description">PPD file record</td></tr>
<tr><th>fd</th>
<td class="description">File to write to</td></tr>
<tr><th>section</th>
<td class="description">Section to write</td></tr>
</tbody></table>
<h4 class="returnvalue">Return Value</h4>
<p class="description">0 on success, -1 on failure</p>
<h3 class="function"><a id="ppdEmitJCL">ppdEmitJCL</a></h3>
<p class="description">Emit code for JCL options to a file.</p>
<p class="code">
int ppdEmitJCL(ppd_file_t *ppd, FILE *fp, int job_id, const char *user, const char *title);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>ppd</th>
<td class="description">PPD file record</td></tr>
<tr><th>fp</th>
<td class="description">File to write to</td></tr>
<tr><th>job_id</th>
<td class="description">Job ID</td></tr>
<tr><th>user</th>
<td class="description">Username</td></tr>
<tr><th>title</th>
<td class="description">Title</td></tr>
</tbody></table>
<h4 class="returnvalue">Return Value</h4>
<p class="description">0 on success, -1 on failure</p>
<h3 class="function"><span class="info">&#160;CUPS 1.2/macOS 10.5&#160;</span><a id="ppdEmitJCLEnd">ppdEmitJCLEnd</a></h3>
<p class="description">Emit JCLEnd code to a file.</p>
<p class="code">
int ppdEmitJCLEnd(ppd_file_t *ppd, FILE *fp);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>ppd</th>
<td class="description">PPD file record</td></tr>
<tr><th>fp</th>
<td class="description">File to write to</td></tr>
</tbody></table>
<h4 class="returnvalue">Return Value</h4>
<p class="description">0 on success, -1 on failure</p>
<h3 class="function"><span class="info">&#160;CUPS 1.2/macOS 10.5&#160;</span><a id="ppdEmitString">ppdEmitString</a></h3>
<p class="description">Get a string containing the code for marked options.</p>
<p class="code">
char *ppdEmitString(ppd_file_t *ppd, <a href="#ppd_section_t">ppd_section_t</a> section, float min_order);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>ppd</th>
<td class="description">PPD file record</td></tr>
<tr><th>section</th>
<td class="description">Section to write</td></tr>
<tr><th>min_order</th>
<td class="description">Lowest OrderDependency</td></tr>
</tbody></table>
<h4 class="returnvalue">Return Value</h4>
<p class="description">String containing option code or <code>NULL</code> if there is no option code</p>
<h4 class="discussion">Discussion</h4>
<p class="discussion">When &quot;min_order&quot; is greater than zero, this function only includes options
whose OrderDependency value is greater than or equal to &quot;min_order&quot;.
Otherwise, all options in the specified section are included in the
returned string.<br>
<br>
The return string is allocated on the heap and should be freed using
<code>free</code> when you are done with it.

</p>
<h3 class="function"><span class="info">&#160;CUPS 1.1.19/macOS 10.3&#160;</span><a id="ppdFindAttr">ppdFindAttr</a></h3>
<p class="description">Find the first matching attribute.</p>
<p class="code">
<a href="#ppd_attr_t">ppd_attr_t</a> *ppdFindAttr(ppd_file_t *ppd, const char *name, const char *spec);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>ppd</th>
<td class="description">PPD file data</td></tr>
<tr><th>name</th>
<td class="description">Attribute name</td></tr>
<tr><th>spec</th>
<td class="description">Specifier string or <code>NULL</code></td></tr>
</tbody></table>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Attribute or <code>NULL</code> if not found</p>
<h3 class="function"><a id="ppdFindChoice">ppdFindChoice</a></h3>
<p class="description">Return a pointer to an option choice.</p>
<p class="code">
<a href="#ppd_choice_t">ppd_choice_t</a> *ppdFindChoice(<a href="#ppd_option_t">ppd_option_t</a> *o, const char *choice);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>o</th>
<td class="description">Pointer to option</td></tr>
<tr><th>choice</th>
<td class="description">Name of choice</td></tr>
</tbody></table>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Choice pointer or <code>NULL</code></p>
<h3 class="function"><span class="info">&#160;CUPS 1.2/macOS 10.5&#160;</span><a id="ppdFindCustomOption">ppdFindCustomOption</a></h3>
<p class="description">Find a custom option.</p>
<p class="code">
ppd_coption_t *ppdFindCustomOption(ppd_file_t *ppd, const char *keyword);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>ppd</th>
<td class="description">PPD file</td></tr>
<tr><th>keyword</th>
<td class="description">Custom option name</td></tr>
</tbody></table>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Custom option or NULL</p>
<h3 class="function"><span class="info">&#160;CUPS 1.2/macOS 10.5&#160;</span><a id="ppdFindCustomParam">ppdFindCustomParam</a></h3>
<p class="description">Find a parameter for a custom option.</p>
<p class="code">
ppd_cparam_t *ppdFindCustomParam(ppd_coption_t *opt, const char *name);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>opt</th>
<td class="description">Custom option</td></tr>
<tr><th>name</th>
<td class="description">Parameter name</td></tr>
</tbody></table>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Custom parameter or NULL</p>
<h3 class="function"><a id="ppdFindMarkedChoice">ppdFindMarkedChoice</a></h3>
<p class="description">Return the marked choice for the specified option.</p>
<p class="code">
<a href="#ppd_choice_t">ppd_choice_t</a> *ppdFindMarkedChoice(ppd_file_t *ppd, const char *option);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>ppd</th>
<td class="description">PPD file</td></tr>
<tr><th>option</th>
<td class="description">Keyword/option name</td></tr>
</tbody></table>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Pointer to choice or <code>NULL</code></p>
<h3 class="function"><span class="info">&#160;CUPS 1.1.19/macOS 10.3&#160;</span><a id="ppdFindNextAttr">ppdFindNextAttr</a></h3>
<p class="description">Find the next matching attribute.</p>
<p class="code">
<a href="#ppd_attr_t">ppd_attr_t</a> *ppdFindNextAttr(ppd_file_t *ppd, const char *name, const char *spec);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>ppd</th>
<td class="description">PPD file data</td></tr>
<tr><th>name</th>
<td class="description">Attribute name</td></tr>
<tr><th>spec</th>
<td class="description">Specifier string or <code>NULL</code></td></tr>
</tbody></table>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Attribute or <code>NULL</code> if not found</p>
<h3 class="function"><a id="ppdFindOption">ppdFindOption</a></h3>
<p class="description">Return a pointer to the specified option.</p>
<p class="code">
<a href="#ppd_option_t">ppd_option_t</a> *ppdFindOption(ppd_file_t *ppd, const char *option);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>ppd</th>
<td class="description">PPD file data</td></tr>
<tr><th>option</th>
<td class="description">Option/Keyword name</td></tr>
</tbody></table>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Pointer to option or <code>NULL</code></p>
<h3 class="function"><span class="info">&#160;CUPS 1.2/macOS 10.5&#160;</span><a id="ppdFirstCustomParam">ppdFirstCustomParam</a></h3>
<p class="description">Return the first parameter for a custom option.</p>
<p class="code">
ppd_cparam_t *ppdFirstCustomParam(ppd_coption_t *opt);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>opt</th>
<td class="description">Custom option</td></tr>
</tbody></table>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Custom parameter or NULL</p>
<h3 class="function"><span class="info">&#160;CUPS 1.2/macOS 10.5&#160;</span><a id="ppdFirstOption">ppdFirstOption</a></h3>
<p class="description">Return the first option in the PPD file.</p>
<p class="code">
<a href="#ppd_option_t">ppd_option_t</a> *ppdFirstOption(ppd_file_t *ppd);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>ppd</th>
<td class="description">PPD file</td></tr>
</tbody></table>
<h4 class="returnvalue">Return Value</h4>
<p class="description">First option or <code>NULL</code></p>
<h4 class="discussion">Discussion</h4>
<p class="discussion">Options are returned from all groups in ascending alphanumeric order.

</p>
<h3 class="function"><span class="info">&#160;CUPS 1.4/macOS 10.6&#160;</span><a id="ppdInstallableConflict">ppdInstallableConflict</a></h3>
<p class="description">Test whether an option choice conflicts with
                             an installable option.</p>
<p class="code">
int ppdInstallableConflict(ppd_file_t *ppd, const char *option, const char *choice);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>ppd</th>
<td class="description">PPD file</td></tr>
<tr><th>option</th>
<td class="description">Option</td></tr>
<tr><th>choice</th>
<td class="description">Choice</td></tr>
</tbody></table>
<h4 class="returnvalue">Return Value</h4>
<p class="description">1 if conflicting, 0 if not conflicting</p>
<h4 class="discussion">Discussion</h4>
<p class="discussion">This function tests whether a particular option choice is available based
on constraints against options in the &quot;InstallableOptions&quot; group.

</p>
<h3 class="function"><a id="ppdIsMarked">ppdIsMarked</a></h3>
<p class="description">Check to see if an option is marked.</p>
<p class="code">
int ppdIsMarked(ppd_file_t *ppd, const char *option, const char *choice);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>ppd</th>
<td class="description">PPD file data</td></tr>
<tr><th>option</th>
<td class="description">Option/Keyword name</td></tr>
<tr><th>choice</th>
<td class="description">Choice name</td></tr>
</tbody></table>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Non-zero if option is marked</p>
<h3 class="function"><span class="info">&#160;CUPS 1.2/macOS 10.5&#160;</span><a id="ppdLocalize">ppdLocalize</a></h3>
<p class="description">Localize the PPD file to the current locale.</p>
<p class="code">
int ppdLocalize(ppd_file_t *ppd);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>ppd</th>
<td class="description">PPD file</td></tr>
</tbody></table>
<h4 class="returnvalue">Return Value</h4>
<p class="description">0 on success, -1 on error</p>
<h4 class="discussion">Discussion</h4>
<p class="discussion">All groups, options, and choices are localized, as are ICC profile
descriptions, printer presets, and custom option parameters.  Each
localized string uses the UTF-8 character encoding.

</p>
<h3 class="function"><a id="ppdLocalizeAttr">ppdLocalizeAttr</a></h3>
<p class="description">Localize an attribute.</p>
<p class="code">
<a href="#ppd_attr_t">ppd_attr_t</a> *ppdLocalizeAttr(ppd_file_t *ppd, const char *keyword, const char *spec);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>ppd</th>
<td class="description">PPD file</td></tr>
<tr><th>keyword</th>
<td class="description">Main keyword</td></tr>
<tr><th>spec</th>
<td class="description">Option keyword or <code>NULL</code> for none</td></tr>
</tbody></table>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Localized attribute or <code>NULL</code> if none exists</p>
<h4 class="discussion">Discussion</h4>
<p class="discussion">This function uses the current locale to find the localized attribute for
the given main and option keywords.  If no localized version of the
attribute exists for the current locale, the unlocalized version is returned.</p>
<h3 class="function"><span class="info">&#160;CUPS 1.3/macOS 10.5&#160;</span><a id="ppdLocalizeIPPReason">ppdLocalizeIPPReason</a></h3>
<p class="description">Get the localized version of a cupsIPPReason
                           attribute.</p>
<p class="code">
const char *ppdLocalizeIPPReason(ppd_file_t *ppd, const char *reason, const char *scheme, char *buffer, size_t bufsize);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>ppd</th>
<td class="description">PPD file</td></tr>
<tr><th>reason</th>
<td class="description">IPP reason keyword to look up</td></tr>
<tr><th>scheme</th>
<td class="description">URI scheme or NULL for text</td></tr>
<tr><th>buffer</th>
<td class="description">Value buffer</td></tr>
<tr><th>bufsize</th>
<td class="description">Size of value buffer</td></tr>
</tbody></table>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Value or NULL if not found</p>
<h4 class="discussion">Discussion</h4>
<p class="discussion">This function uses the current locale to find the corresponding reason
text or URI from the attribute value. If &quot;scheme&quot; is NULL or &quot;text&quot;,
the returned value contains human-readable (UTF-8) text from the translation
string or attribute value. Otherwise the corresponding URI is returned.<br>
<br>
If no value of the requested scheme can be found, NULL is returned.

</p>
<h3 class="function"><span class="info">&#160;CUPS 1.4/macOS 10.6&#160;</span><a id="ppdLocalizeMarkerName">ppdLocalizeMarkerName</a></h3>
<p class="description">Get the localized version of a marker-names
                            attribute value.</p>
<p class="code">
const char *ppdLocalizeMarkerName(ppd_file_t *ppd, const char *name);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>ppd</th>
<td class="description">PPD file</td></tr>
<tr><th>name</th>
<td class="description">Marker name to look up</td></tr>
</tbody></table>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Value or <code>NULL</code> if not found</p>
<h4 class="discussion">Discussion</h4>
<p class="discussion">This function uses the current locale to find the corresponding name
text from the attribute value. If no localized text for the requested
name can be found, <code>NULL</code> is returned.

</p>
<h3 class="function"><a id="ppdMarkDefaults">ppdMarkDefaults</a></h3>
<p class="description">Mark all default options in the PPD file.</p>
<p class="code">
void ppdMarkDefaults(ppd_file_t *ppd);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>ppd</th>
<td class="description">PPD file record</td></tr>
</tbody></table>
<h3 class="function"><a id="ppdMarkOption">ppdMarkOption</a></h3>
<p class="description">Mark an option in a PPD file and return the number of
                    conflicts.</p>
<p class="code">
int ppdMarkOption(ppd_file_t *ppd, const char *option, const char *choice);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>ppd</th>
<td class="description">PPD file record</td></tr>
<tr><th>option</th>
<td class="description">Keyword</td></tr>
<tr><th>choice</th>
<td class="description">Option name</td></tr>
</tbody></table>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Number of conflicts</p>
<h3 class="function"><span class="info">&#160;CUPS 1.2/macOS 10.5&#160;</span><a id="ppdNextCustomParam">ppdNextCustomParam</a></h3>
<p class="description">Return the next parameter for a custom option.</p>
<p class="code">
ppd_cparam_t *ppdNextCustomParam(ppd_coption_t *opt);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>opt</th>
<td class="description">Custom option</td></tr>
</tbody></table>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Custom parameter or NULL</p>
<h3 class="function"><span class="info">&#160;CUPS 1.2/macOS 10.5&#160;</span><a id="ppdNextOption">ppdNextOption</a></h3>
<p class="description">Return the next option in the PPD file.</p>
<p class="code">
<a href="#ppd_option_t">ppd_option_t</a> *ppdNextOption(ppd_file_t *ppd);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>ppd</th>
<td class="description">PPD file</td></tr>
</tbody></table>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Next option or <code>NULL</code></p>
<h4 class="discussion">Discussion</h4>
<p class="discussion">Options are returned from all groups in ascending alphanumeric order.

</p>
<h3 class="function"><a id="ppdPageLength">ppdPageLength</a></h3>
<p class="description">Get the page length for the given size.</p>
<p class="code">
float ppdPageLength(ppd_file_t *ppd, const char *name);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>ppd</th>
<td class="description">PPD file</td></tr>
<tr><th>name</th>
<td class="description">Size name</td></tr>
</tbody></table>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Length of page in points or 0.0</p>
<h3 class="function"><a id="ppdPageSize">ppdPageSize</a></h3>
<p class="description">Get the page size record for the named size.</p>
<p class="code">
ppd_size_t *ppdPageSize(ppd_file_t *ppd, const char *name);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>ppd</th>
<td class="description">PPD file record</td></tr>
<tr><th>name</th>
<td class="description">Size name</td></tr>
</tbody></table>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Size record for page or NULL</p>
<h3 class="function"><span class="info">&#160;CUPS 1.4/macOS 10.6&#160;</span><a id="ppdPageSizeLimits">ppdPageSizeLimits</a></h3>
<p class="description">Return the custom page size limits.</p>
<p class="code">
int ppdPageSizeLimits(ppd_file_t *ppd, ppd_size_t *minimum, ppd_size_t *maximum);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>ppd</th>
<td class="description">PPD file record</td></tr>
<tr><th>minimum</th>
<td class="description">Minimum custom size</td></tr>
<tr><th>maximum</th>
<td class="description">Maximum custom size</td></tr>
</tbody></table>
<h4 class="returnvalue">Return Value</h4>
<p class="description">1 if custom sizes are supported, 0 otherwise</p>
<h4 class="discussion">Discussion</h4>
<p class="discussion">This function returns the minimum and maximum custom page sizes and printable
areas based on the currently-marked (selected) options.<br>
<br>
If the specified PPD file does not support custom page sizes, both
&quot;minimum&quot; and &quot;maximum&quot; are filled with zeroes.

</p>
<h3 class="function"><a id="ppdPageWidth">ppdPageWidth</a></h3>
<p class="description">Get the page width for the given size.</p>
<p class="code">
float ppdPageWidth(ppd_file_t *ppd, const char *name);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>ppd</th>
<td class="description">PPD file record</td></tr>
<tr><th>name</th>
<td class="description">Size name</td></tr>
</tbody></table>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Width of page in points or 0.0</p>
<h2 class="title"><a id="TYPES">Data Types</a></h2>
<h3 class="typedef"><a id="cups_interpret_cb_t">cups_interpret_cb_t</a></h3>
<p class="description">cupsRasterInterpretPPD callback function</p>
<p class="code">
typedef int (*cups_interpret_cb_t)(cups_page_header2_t *header, int preferred_bits);
</p>
<h3 class="typedef"><a id="ppd_attr_t"><span class="info">&#160;DEPRECATED&#160;</span>ppd_attr_t</a></h3>
<p class="description">PPD Attribute Structure </p>
<p class="code">
typedef struct <a href="#ppd_attr_s">ppd_attr_s</a> ppd_attr_t;
</p>
<h3 class="typedef"><a id="ppd_choice_t"><span class="info">&#160;DEPRECATED&#160;</span>ppd_choice_t</a></h3>
<p class="description">Option choices </p>
<p class="code">
typedef struct <a href="#ppd_choice_s">ppd_choice_s</a> ppd_choice_t;
</p>
<h3 class="typedef"><a id="ppd_conform_t"><span class="info">&#160;DEPRECATED&#160;</span>ppd_conform_t</a></h3>
<p class="description">Conformance Levels </p>
<p class="code">
typedef enum <a href="#ppd_conform_e">ppd_conform_e</a> ppd_conform_t;
</p>
<h3 class="typedef"><a id="ppd_cs_t"><span class="info">&#160;DEPRECATED&#160;</span>ppd_cs_t</a></h3>
<p class="description">Colorspaces </p>
<p class="code">
typedef enum <a href="#ppd_cs_e">ppd_cs_e</a> ppd_cs_t;
</p>
<h3 class="typedef"><a id="ppd_option_t"><span class="info">&#160;DEPRECATED&#160;</span>ppd_option_t</a></h3>
<p class="description">Options </p>
<p class="code">
typedef struct <a href="#ppd_option_s">ppd_option_s</a> ppd_option_t;
</p>
<h3 class="typedef"><a id="ppd_section_t"><span class="info">&#160;DEPRECATED&#160;</span>ppd_section_t</a></h3>
<p class="description">Order dependency sections </p>
<p class="code">
typedef enum <a href="#ppd_section_e">ppd_section_e</a> ppd_section_t;
</p>
<h3 class="typedef"><a id="ppd_status_t"><span class="info">&#160;DEPRECATED&#160;</span>ppd_status_t</a></h3>
<p class="description">Status Codes </p>
<p class="code">
typedef enum <a href="#ppd_status_e">ppd_status_e</a> ppd_status_t;
</p>
<h3 class="typedef"><a id="ppd_ui_t"><span class="info">&#160;DEPRECATED&#160;</span>ppd_ui_t</a></h3>
<p class="description">UI Types </p>
<p class="code">
typedef enum <a href="#ppd_ui_e">ppd_ui_e</a> ppd_ui_t;
</p>
<h2 class="title"><a id="STRUCTURES">Structures</a></h2>
<h3 class="struct"><span class="info">&#160;DEPRECATED&#160;</span><a id="ppd_attr_s">ppd_attr_s</a></h3>
<p class="description">PPD Attribute Structure </p>
<p class="code">struct ppd_attr_s {<br>
&#160;&#160;&#160;&#160;char name[PPD_MAX_NAME];<br>
&#160;&#160;&#160;&#160;char spec[PPD_MAX_NAME];<br>
&#160;&#160;&#160;&#160;char text[PPD_MAX_TEXT];<br>
&#160;&#160;&#160;&#160;char *value;<br>
};</p>
<h4 class="members">Members</h4>
<table class="list"><tbody>
<tr><th>name[PPD_MAX_NAME] </th>
<td class="description">Name of attribute (cupsXYZ)</td></tr>
<tr><th>spec[PPD_MAX_NAME] </th>
<td class="description">Specifier string, if any</td></tr>
<tr><th>text[PPD_MAX_TEXT] </th>
<td class="description">Human-readable text, if any</td></tr>
<tr><th>value </th>
<td class="description">Value string</td></tr>
</tbody></table>
<h3 class="struct"><span class="info">&#160;DEPRECATED&#160;</span><a id="ppd_choice_s">ppd_choice_s</a></h3>
<p class="description">Option choices </p>
<p class="code">struct ppd_choice_s {<br>
&#160;&#160;&#160;&#160;char choice[PPD_MAX_NAME];<br>
&#160;&#160;&#160;&#160;char *code;<br>
&#160;&#160;&#160;&#160;char marked;<br>
&#160;&#160;&#160;&#160;<a href="#ppd_option_t">ppd_option_t</a> *option;<br>
&#160;&#160;&#160;&#160;char text[PPD_MAX_TEXT];<br>
};</p>
<h4 class="members">Members</h4>
<table class="list"><tbody>
<tr><th>choice[PPD_MAX_NAME] </th>
<td class="description">Computer-readable option name</td></tr>
<tr><th>code </th>
<td class="description">Code to send for this option</td></tr>
<tr><th>marked </th>
<td class="description">0 if not selected, 1 otherwise</td></tr>
<tr><th>option </th>
<td class="description">Pointer to parent option structure</td></tr>
<tr><th>text[PPD_MAX_TEXT] </th>
<td class="description">Human-readable option name</td></tr>
</tbody></table>
<h3 class="struct"><span class="info">&#160;DEPRECATED&#160;</span><a id="ppd_group_s">ppd_group_s</a></h3>
<p class="description">Groups </p>
<p class="code">struct ppd_group_s {<br>
};</p>
<h4 class="members">Members</h4>
<table class="list"><tbody>
</tbody></table>
<h3 class="struct"><span class="info">&#160;DEPRECATED&#160;</span><a id="ppd_option_s">ppd_option_s</a></h3>
<p class="description">Options </p>
<p class="code">struct ppd_option_s {<br>
&#160;&#160;&#160;&#160;<a href="#ppd_choice_t">ppd_choice_t</a> *choices;<br>
&#160;&#160;&#160;&#160;char conflicted;<br>
&#160;&#160;&#160;&#160;char defchoice[PPD_MAX_NAME];<br>
&#160;&#160;&#160;&#160;char keyword[PPD_MAX_NAME];<br>
&#160;&#160;&#160;&#160;int num_choices;<br>
&#160;&#160;&#160;&#160;float order;<br>
&#160;&#160;&#160;&#160;<a href="#ppd_section_t">ppd_section_t</a> section;<br>
&#160;&#160;&#160;&#160;char text[PPD_MAX_TEXT];<br>
&#160;&#160;&#160;&#160;<a href="#ppd_ui_t">ppd_ui_t</a> ui;<br>
};</p>
<h4 class="members">Members</h4>
<table class="list"><tbody>
<tr><th>choices </th>
<td class="description">Option choices</td></tr>
<tr><th>conflicted </th>
<td class="description">0 if no conflicts exist, 1 otherwise</td></tr>
<tr><th>defchoice[PPD_MAX_NAME] </th>
<td class="description">Default option choice</td></tr>
<tr><th>keyword[PPD_MAX_NAME] </th>
<td class="description">Option keyword name (&quot;PageSize&quot;, etc.)</td></tr>
<tr><th>num_choices </th>
<td class="description">Number of option choices</td></tr>
<tr><th>order </th>
<td class="description">Order number</td></tr>
<tr><th>section </th>
<td class="description">Section for command</td></tr>
<tr><th>text[PPD_MAX_TEXT] </th>
<td class="description">Human-readable text</td></tr>
<tr><th>ui </th>
<td class="description">Type of UI option</td></tr>
</tbody></table>
<h2 class="title"><a id="ENUMERATIONS">Constants</a></h2>
<h3 class="enumeration"><a id="ppd_conform_e"><span class="info">&#160;DEPRECATED&#160;</span>ppd_conform_e</a></h3>
<p class="description">Conformance Levels </p>
<h4 class="constants">Constants</h4>
<table class="list"><tbody>
<tr><th>PPD_CONFORM_RELAXED </th><td class="description">Relax whitespace and control char</td></tr>
<tr><th>PPD_CONFORM_STRICT </th><td class="description">Require strict conformance</td></tr>
</tbody></table>
<h3 class="enumeration"><a id="ppd_cs_e"><span class="info">&#160;DEPRECATED&#160;</span>ppd_cs_e</a></h3>
<p class="description">Colorspaces </p>
<h4 class="constants">Constants</h4>
<table class="list"><tbody>
<tr><th>PPD_CS_CMY </th><td class="description">CMY colorspace</td></tr>
<tr><th>PPD_CS_CMYK </th><td class="description">CMYK colorspace</td></tr>
<tr><th>PPD_CS_GRAY </th><td class="description">Grayscale colorspace</td></tr>
<tr><th>PPD_CS_N </th><td class="description">DeviceN colorspace</td></tr>
<tr><th>PPD_CS_RGB </th><td class="description">RGB colorspace</td></tr>
<tr><th>PPD_CS_RGBK </th><td class="description">RGBK (K = gray) colorspace</td></tr>
</tbody></table>
<h3 class="enumeration"><a id="ppd_section_e"><span class="info">&#160;DEPRECATED&#160;</span>ppd_section_e</a></h3>
<p class="description">Order dependency sections </p>
<h4 class="constants">Constants</h4>
<table class="list"><tbody>
<tr><th>PPD_ORDER_ANY </th><td class="description">Option code can be anywhere in the file</td></tr>
<tr><th>PPD_ORDER_DOCUMENT </th><td class="description">... must be in the DocumentSetup section</td></tr>
<tr><th>PPD_ORDER_EXIT </th><td class="description">... must be sent prior to the document</td></tr>
<tr><th>PPD_ORDER_JCL </th><td class="description">... must be sent as a JCL command</td></tr>
<tr><th>PPD_ORDER_PAGE </th><td class="description">... must be in the PageSetup section</td></tr>
<tr><th>PPD_ORDER_PROLOG </th><td class="description">... must be in the Prolog section</td></tr>
</tbody></table>
<h3 class="enumeration"><a id="ppd_status_e"><span class="info">&#160;DEPRECATED&#160;</span>ppd_status_e</a></h3>
<p class="description">Status Codes </p>
<h4 class="constants">Constants</h4>
<table class="list"><tbody>
<tr><th>PPD_ALLOC_ERROR </th><td class="description">Memory allocation error</td></tr>
<tr><th>PPD_BAD_CLOSE_UI </th><td class="description">Bad CloseUI/JCLCloseUI</td></tr>
<tr><th>PPD_BAD_CUSTOM_PARAM </th><td class="description">Bad custom parameter</td></tr>
<tr><th>PPD_BAD_OPEN_GROUP </th><td class="description">Bad OpenGroup</td></tr>
<tr><th>PPD_BAD_OPEN_UI </th><td class="description">Bad OpenUI/JCLOpenUI</td></tr>
<tr><th>PPD_BAD_ORDER_DEPENDENCY </th><td class="description">Bad OrderDependency</td></tr>
<tr><th>PPD_BAD_UI_CONSTRAINTS </th><td class="description">Bad UIConstraints</td></tr>
<tr><th>PPD_BAD_VALUE </th><td class="description">Bad value string</td></tr>
<tr><th>PPD_FILE_OPEN_ERROR </th><td class="description">Unable to open PPD file</td></tr>
<tr><th>PPD_ILLEGAL_CHARACTER </th><td class="description">Illegal control character</td></tr>
<tr><th>PPD_ILLEGAL_MAIN_KEYWORD </th><td class="description">Illegal main keyword string</td></tr>
<tr><th>PPD_ILLEGAL_OPTION_KEYWORD </th><td class="description">Illegal option keyword string</td></tr>
<tr><th>PPD_ILLEGAL_TRANSLATION </th><td class="description">Illegal translation string</td></tr>
<tr><th>PPD_ILLEGAL_WHITESPACE </th><td class="description">Illegal whitespace character</td></tr>
<tr><th>PPD_INTERNAL_ERROR </th><td class="description">Internal error</td></tr>
<tr><th>PPD_LINE_TOO_LONG </th><td class="description">Line longer than 255 chars</td></tr>
<tr><th>PPD_MISSING_ASTERISK </th><td class="description">Missing asterisk in column 0</td></tr>
<tr><th>PPD_MISSING_CLOSE_GROUP </th><td class="description">Missing CloseGroup</td></tr>
<tr><th>PPD_MISSING_CLOSE_UI </th><td class="description">Missing CloseUI/JCLCloseUI</td></tr>
<tr><th>PPD_MISSING_OPTION_KEYWORD </th><td class="description">Missing option keyword</td></tr>
<tr><th>PPD_MISSING_PPDADOBE4 </th><td class="description">Missing PPD-Adobe-4.x header</td></tr>
<tr><th>PPD_MISSING_VALUE </th><td class="description">Missing value string</td></tr>
<tr><th>PPD_NESTED_OPEN_GROUP </th><td class="description">OpenGroup without a CloseGroup first</td></tr>
<tr><th>PPD_NESTED_OPEN_UI </th><td class="description">OpenUI/JCLOpenUI without a CloseUI/JCLCloseUI first</td></tr>
<tr><th>PPD_NULL_FILE </th><td class="description">NULL PPD file pointer</td></tr>
<tr><th>PPD_OK </th><td class="description">OK</td></tr>
</tbody></table>
<h3 class="enumeration"><a id="ppd_ui_e"><span class="info">&#160;DEPRECATED&#160;</span>ppd_ui_e</a></h3>
<p class="description">UI Types </p>
<h4 class="constants">Constants</h4>
<table class="list"><tbody>
<tr><th>PPD_UI_BOOLEAN </th><td class="description">True or False option</td></tr>
<tr><th>PPD_UI_PICKMANY </th><td class="description">Pick zero or more from a list</td></tr>
<tr><th>PPD_UI_PICKONE </th><td class="description">Pick one from a list</td></tr>
</tbody></table>
</div>
</body>
</html>
